<%--
  Created by IntelliJ IDEA.

  Date: 2021/6/26
  Time: 16:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="ProjectServlet.Community" %>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>空间信息查询</title>
</head>
<body>
    <form action="http://localhost:8081/web2_war_exploded/servletForLog" method="get">
        <input type="hidden" name="action" value="spaceSelectServer">
        <h1 align="center">空间查询</h1>a
        <table align="center">
            <tr>
                <td>查询学校周边房源:</td>
                <td><input type="radio" name="spaceSelect" value="school" checked="checked"></td>
            </tr>
            <tr>
                <td>查询医院周边房源:</td>
                <td><input type="radio" name="spaceSelect" value="hospital" ></td>
            </tr>
            <tr>
                <td>查询其他服务设施的周边房源:</td>
                <td><input type="radio" name="spaceSelect" value="other" ></td>
            </tr>
            <tr>
                <td>输入查询的内容:</td>
                <td><input type="text" name="spaceText" value="" ></td>
            </tr>
            <tr>
                <td><input type="submit" value="查询"></td>
            </tr>
        </table>

    </form>

    <%
        List<ProjectServlet.SpaceName> space= (List<ProjectServlet.SpaceName>)request.getAttribute("space");
    %>
    <form action="http://localhost:8081/web2_war_exploded/servletForLog" method="get">
        <input type="hidden" name="action" value="findCommunity">
    <table align="center">

        <tr><%
        if(space!=null)
        {%>
        <tr>
        <h1 align="center"> 相关设施</h1>
            <th>类型</th>
            <th>名称</th>
            <th>id</th>
        </tr>
        <%
        for(ProjectServlet.SpaceName S:space)
        { %>
        <tr>
            <td><%=S.getType()%></td>
            <td><%=S.getName()%></td>
            <td><input type="submit" name="spaceBtn" value="<%=S.getId()%>" style="width:60px;height:40px" ></td>
        </tr>
        <%      }
        }
        %>
        </table>

    </form>

    <%
        List<ProjectServlet.Community> communities= (List<ProjectServlet.Community>)request.getAttribute("community");
    %>
    <form action="http://localhost:8081/web2_war_exploded/servletForLog" method="get">
        <input type="hidden" name="action" value="showCommunity">
        <table align="center">

            <tr><%
        if(communities!=null)
        {%>
                <h1 align="center">该设施附近小区 </h1>
            <tr>
                <th>行政区</th>
                <th>名称</th>
                <th>距离(米)</th>
                <th>id</th>
            </tr>
            <%
                for(ProjectServlet.Community C:communities)
                { %>
            <tr>
                <td><%=C.getAdm()%></td>
                <td><%=C.getName()%></td>
                <td><%=C.getDistance()%></td>
                <td><input type="submit" name="communityBtn" value="<%=C.getId()%>" style="width:60px;height:40px" ></td>
            </tr>
            <%      }
            }
            %>
        </table>

    </form>
</body>
</html>
